package reflectstudy;


@MyAnnotation(value = "hello")
public class Student extends Person implements MyInterface{
    private int stuno;//学号
    double height;
    protected double weight;
    public double score;

    @MyAnnotation(value = "myMethod")
    public String showInfo(){
        System.out.println("我是一名三好学生");
        return "我是一名三好学生";
    }

    public String showInfo(int a){
        System.out.println("重载方法 showInfo");
        return "执行showInfo方法";
    }

    protected  int getSno(){
        return stuno;
    }

    void happy(){
        System.out.println("做人最重要就是开心");
    }

    @MyAnnotation(value = "test-work")
    private void work(){
        System.out.println("我的梦想是");
    }

    public Student(){
        System.out.println("无参构造方法");
    }

    public Student(double weight, double height){
        this.weight = weight;
        this.height = height;
    }

    private Student(int sno){
        this.stuno = sno;
    }

    private Student(int sno, double weight){
        this.stuno = sno;
        this.weight = weight;
    }

    protected Student(int sno, double height, double weight){
        this.stuno = sno;
        this.height = height;
        this.weight = weight;
    }

    @Override
    public String toString() {
        return "Student{" +
                "stuno=" + stuno +
                ", height=" + height +
                ", weight=" + weight +
                ", score=" + score +
                '}';
    }

    // @Override 【@Retention(RetentionPolicy.SOURCE)】 只是在编译时检查 不再运行时  所以获取不到
    @Override
    @MyAnnotation(value = "hello-myMethod")
    public void myMethod() throws RuntimeException {
        System.out.println("重写 MyInterface 的 myMethod方法");
    }
}
